home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
pctj0987.arc
/
MISS.C
< prev
next >
Wrap
Text File
|
1987-07-02
|
2KB
|
78 lines
/*
* MISS --PC Tech Journal Laser Printer Miscellanous Tests
*
* Version 1.0
*
* Copyright (c) 1987, Ziff Communications Company
* Program by: Rainer McCown and Bob Smith
* Common Routines for C programs.
*/
#include "io.h"
#include "dos.h"
#include "string.h"
#include "fcntl.h"
#define STD_OUT 1
/****************************** SNDL *******************************/
/* Use this routine when the string-to-be-printed
contains embedded binary zeros (which can confuse
the STRLEN function used in SND). */
void sndl(sray, len)
char sray[];
int len;
{
if (len != write(STD_OUT, sray, len)) printf("%s\r\n", sray);
}
/****************************** SND ********************************/
/* Use this routine to send a string
to the standard printer */
void snd(sray)
char sray[];
{
sndl(sray, strlen(sray));
}
/*************************** SETBINARY *****************************/
/* Change a file handle to binary mode to avoid
converting LFs to CR,LF and to avoid
stopping on EOFs */
void setbinary(fh)
int fh;
{
union REGS inregs;
/* Change to binary mode via SETMODE
to avoid converting LF to CR,LF */
setmode(fh, O_BINARY);
/* Change to binary mode via IOCTL
to avoid stopping on EOF */
inregs.x.ax = 0x4400; /* Fn code to get device information */
inregs.x.bx = fh; /* For the file handle */
intdos(&inregs, &inregs); /* Return device info in DX */
if(inregs.x.dx & 0x0080) /* If it's a device, ... */
{
inregs.h.dh = 0; /* Ensure zero */
inregs.x.dx |= 0x0020; /* Turn on binary mode bit */
inregs.x.ax = 0x4401; /* Fn code to set device information */
intdos(&inregs, &inregs); /* Set device info from DX */
}
}